<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <title>通知详情</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../../../css/mui.min.css" rel="stylesheet" />
    <link href="../css/common.css" rel="stylesheet" />
    <style>
      .content {
        color: #686875;
      }
      
      .btns {
        text-align: center;
      }
      
      .btns .mui-btn {
        min-width: 120px;
        height: 40px;
        border-radius: 20px;
      }
      
      .head_top {
        padding: 30px 0;
        overflow: hidden;
      }
      
      .icon_img {
        float: left;
        width: 80px;
        height: 80px;
        background: url(./img/tongzhidan.png) no-repeat;
        background-size: 100%;
      }
      
      .txt_s {
        float: left;
        vertical-align: middle;
        height: 80px;
        line-height: 80px;
        padding-left: 20px;
        color: #3188FE;
      }
      
      .iscreate {
        height: 260px;
        background: #ECF3FB;
        border-radius: 10px;
        border: solid 1px #A5C3EC;
        padding: 15px;
      }
      
      .mui-popover-action {
        height: 100%;
      }
      
      .fr-div-w {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        padding: 15px;
        border-radius: 5px;
        background: #fff;
      }
      
      .mui-popover-arrow {
        display: none;
      }
      input{
        margin: 0 !important;
      }
      .text-label{
        margin-right: 5px;
        white-space: nowrap;
      }
    </style>
  </head>

  <body>
    <div class="page-wrap" id="container">
      <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left text-white"></a>
        <h1 class="mui-title">通知详情</h1>
      </header>
      <div class="mui-content bg-white page-scroll">
        <div v-cloak>
          <div class="padding border-bottom">
            <div>{{detail.title}}</div>
            <div class="margin-top-xs text-sm color-999">{{detail.createTime}}</div>
          </div>
          <div class="padding content">
            {{detail.content}}
          </div>
          <div class="lis iscreate remind" v-if="remindShow">
              <div class="head_top"><span class="icon_img"></span><span class="txt_s">是否需要生成通知单？</span></div>
              <div class="btns">
                <button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" @click="creat(0)">不生成</button>
                <button type="button" class="mui-btn mui-btn-primary" @click="creat(1)">生成</button>
              </div>
            </div>
        </div>
      </div>
      <div class="fixed-btn" id="btnShow" style="display: none;">
        <button type="button" class="mui-btn mui-btn-primary" @click="to">去确认</button>
      </div>
    </div>

    <script src="../../../js/mui.min.js"></script>
    <script src="../js/mkeyplus.base.js"></script>
    <script src="../../../js/jquery-1.7.2.min.js"></script>
    <script src="../../../js/mui.picker.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../../css/mui.picker.min.css" />
    <script src="../../../js/vue.js"></script>
    <script type="text/javascript">
      mui.init()
      if(window.plus) {
        plusready();
      } else {
        document.addEventListener('plusready', plusready, false);
      }
      let type;

      function plusready() {
        var self = plus.webview.currentWebview();
        vm.id = self.itemId
        // type 275系统通知  276 计划通知   277 工序退回通知  278技术交底确认通知  279生成通知单通知
        type = self.type
        console.log(type)
        if(type != 275 && type != 276 && type != 279) {
          $("#btnShow").show()
        } else if(type == 279) {
          vm.remindShow = true
        }
        plus.nativeUI.showWaiting('加载中')
        vm.read()
        vm.getData()
      } 
      let vm = new Vue({
        el: "#container",
        data: {
          id: null,
          detail: {},
          startTime: null,
          endTime: null,
          remindShow: false
        },
        created: function() {

        },
        methods: {
          getData() {
            mui.baseApp.httpRequst('get', '/app/api/notice/' + this.id, {}, (res) => {
              console.log(res)
              res.data.extend ? res.data.extend = JSON.parse(res.data.extend) : ''
              this.detail = res.data
              plus.nativeUI.closeWaiting()
            })
          },
          read() {
            mui.baseApp.httpRequst('post', '/app/api/notice/read/' + this.id, {}, (res) => {
              console.log(res)
            })
          },
          to() {
            console.log("3333333")
            console.log(type)
            let detail = this.detail.extend
            if(type == 277) {
              let params = {
                projectTaskId: detail.projectTaskId,
                projectCategory: detail.projectCategory,
                projectTaskWpId: detail.projectTaskWpId
              }
              console.log(params)
              mui.baseApp.openWindow('../personChange/detail.html', params)
            } else if(type == 278) {
              mui.baseApp.openWindow('../disclose/disclose.html', {
                projectId: detail.projectId,
              })
            } else if(type == 279) {
              mui.baseApp.openWindow('./remind.html', {
                id: item.id,
                type: item.type
              })
            }
          },
          creat(status) {
            let detail = this.detail.extend
            if(status == 0) {
               mui.baseApp.openWindow('./remind.html', {
                projectTaskId: detail.projectTaskId,
                status: status
              })
            } else {
              mui.baseApp.httpRequst('post', '/app/api/notice/create/task/' + detail.projectTaskId, {}, function(res) {
                console.log(res)
                mui.toast("操作成功")
                mui.back()
              })
            }
           
          }
        },
      })
    </script>
  </body>

</html>